<?php
#基础函数
include_once('_path.php');

#通用函数
include_once(_CONST_LOCAL_INCLUDE_PATH."common.php");

#db
include_once(_CONST_LOCAL_INCLUDE_PATH."database.class.php");
$database = new Database($db_vars);

#权限
if (!is_logined()) {
header("Location:"._CONST_WEB_URL."login-company.html");
exit;
}

#翻页
$page = trim($_GET['page']) + 0; if ($page == "") { $page = $_COOKIE['compage']; }
$pagesize = 20;
#!!翻页
if ($page < 1) $page = 1;
#总共数量
#获得企业名称
$rso = $database->queryFirst("SELECT company_name FROM customers WHERE id=".$_SESSION['user_id']);
$company_name = $rso['company_name'];
$rs_count = $database->queryArray("SELECT count(*) total FROM members_info WHERE company=".string_sql($company_name));
$total_page = ceil($rs_count[0]["total"] / $pagesize);
if ($total_page < 1) $total_page = 1;
if ($page > $total_page) $page = $total_page;
set_cookie('compage', $page, time() + 604800);
$rsc = $database->queryArray("SELECT * FROM members_info WHERE company=".string_sql($company_name)." LIMIT ".(($page - 1) * $pagesize).", $pagesize");
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>用户中心-Haiersi•GL-海尔斯管历健康服务网</title>
	<link href="../media/css/reset.css" rel="stylesheet" type="text/css"/>
	<link href="../media/css/base.css" rel="stylesheet" type="text/css"/>
</head>
<body id="uc">
<div class="wrapper">
	<div class="header clearfix">
		<a  class="logo fl" href="../index.html"><h1>Hesgl</h1></a>
		<ul class="nav fr clearfix">
			<li class="cur"><a href="../index.html">首页</a></li>
			<li><a href="../about-us.html">关于我们</a></li>
			<li><a href="../services.html">我们的服务</a></li>
			<li><a href="../approach.html">我们的方法</a></li>
			<li><a href="../health.html">企业健康管理</a></li>
			<li><a href="../news.html">新闻</a></li>
			<li class="last"><a href="../contacts.html">联系我们</a></li>
		</ul>
	</div>

    <div class="content clearfix">
    	<div class="user-info">欢迎<em><?=$_SESSION['name']?></em> ［<a href="../logout.php">退出登录</a>］</div>
        <div class="main">
	<div class="traininc-nav-list">
        		<ul>
        			<li><a href="com-home.html">基本信息</a></li>
        			<li class="selected"><a href="com-list.html">员工列表</a></li>
        		</ul>
        	</div>
        	<div class="box-con">
	        		<table class="table-blue">
	        			<thead>
	        				<tr>
	        					<th>编号</th>
	        					<th>姓名</th>
	        					<th>手机</th>
	        					<th>地址</th>
	        				</tr>
	        			</thead>
	        			<tbody>
<?
                                                for($i=0;$i<sizeof($rsc);$i++){
                                                $r = $rsc[$i];
                                                $j = 1;
                                                ?>
                                                <tr <?=iif($j%2==0, 'class="odd"')?>>
                                                        <td><?=$r['id']?></td>
                                                        <td><?=$r['name']?></td>
                                                        <td><?=$r['tel']?></td>
                                                        <td><?=$r['region']?></td> 
                                                </tr>
                                                <?
                                                $j++;
                                                }
                                                ?>
	        			</tbody>
	        		</table>

	        		<div class="digg"><? pagination($page, $pagesize, $rs_count[0]["total"], "com-list.php&page=%s%") ?></div>

        	</div>
        </div>

    </div>
	<div class="footer">
	    <p class="copyright">Copyright © 2011 Hesgl.com All Rights Reserved</p>
	</div>
</div>
</body>
</html>
